﻿using System;
using System.Windows;
using System.Windows.Controls;
using jSLCore.Client.Presentation.BaseControl.Selection;
using jSLCore.Client.Presentation.Controls;
using jSLCore.Client.Presentation.Wpf.TelerikSupport.Selection;
using jSLCore.Client.Utility;
using Telerik.Windows.Controls;
using HyperlinkButton = jSLCore.Client.Presentation.Controls.HyperlinkButton;

namespace jSLCore.Client.Presentation.Wpf.TelerikSupport.Selection.Columns
{
    /// <summary>
    /// Interaction logic for GoDetailsColumn.xaml
    /// </summary>
    public partial class GoDetailsColumn : GridViewDataColumn
    {
        public GoDetailsColumn()
        {
            InitializeComponent();
        }

        private void hp_Loaded(object sender, RoutedEventArgs e)
        {
            var hyperlinkButton = (HyperlinkButton)sender;
            if (DataMemberBinding != null)
            {
                hyperlinkButton.SetBinding(TextBlock.TextProperty, DataMemberBinding);
            }
        }

        private void goDetails_Clicked(object sender, EventArgs e)
        {
            var element = (FrameworkElement)sender;
            var selectableGrid = element.FindAncestor<jSLRadGrid>();
            selectableGrid.InvokeGoDetailsClick((new RowSelectedEventArgs(element.DataContext)));
        }
    }
}
